package com.example.eeuse.model;


import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.annotation.JSONField;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import lombok.Data;
import org.dromara.easyes.annotation.IndexField;
import org.dromara.easyes.annotation.IndexName;
import org.dromara.easyes.annotation.rely.FieldType;
import java.util.Date;

@Data
@IndexName("shopping_log_cache_update-*")
public class LogUpdateCache {
    @IndexField("CACHE_KEY")
    private String cacheKey;
    private String id;

    @IndexField("@timestamp")
    @JSONField(deserializeUsing = DateTypeSerializer.class)
    private Date time;

    public static void main(String[] args) throws JsonProcessingException {
        String msg="{\"@timestamp\":\"2023-09-11 07:55:45\",\"TIMESTAMP\":\"2023-09-11 01:46:07.549\",\"EXPIRE_TIME\":\"2023-09-11 02:06:07\",\"host\":{\"ip\":[\"10.79.2.79\",\"fe80::215:5dff:fe82:1dc6\"],\"id\":\"5de6df44d30e73e768ed4e510000004b\"},\"TRACE_ID\":\"70603e701b00400aabebc21b80b2487a\",\"message\":\"2023-09-11 01:46:07.549 70603e701b00400aabebc21b80b2487a,LOG_CACHE_UPDATE,2023-09-11 02:06:07,1d810dcead31e3658faa10cf8d746dda,AV_QUERY_CAN018:URCCGO20231109CZtrue\",\"fields\":{},\"CACHE_KEY\":\"AV_QUERY_CAN018:URCCGO20231109CZtrue\"}";
        LogUpdateCache logUpdateCache= JSON.parseObject(msg,LogUpdateCache.class);
        System.out.println(logUpdateCache);
        System.out.println(System.currentTimeMillis());
    }
}
